import datetime
import dateutil.relativedelta import relativedelta

def time_param(cnt=12, offset=1)

    dt_now = datetime.datetime.now()
    dt = dt_now - relativedelta(days=offset)

    print('Run time {}'.format(dt_now.strftime('%Y-%m-%d %H:%M:%S')))

    dt_params = {}

    for i in range(cnt):
        dt_params['{}_day_ago'.format(i)] = dt - relativedelta(days=i)
        dt_params['{}_mth_ago'.format(i)] = dt - relativedelta(months=i)
        dt_params['{}_mth_ago_st'.format(i)] = (dt - relativedelta(months=i)).replace(day=1)
        dt_params['{}_mth_ago_ed'.format(i)] = (dt - relativedelta(months=i-1)).replace(day=1) - relativedelta(days=i)
    
    return dt_params